const mongoose = require('mongoose')
const config = require('../config')

// 连接mongodb
mongoose.connect(config.db.url)

const db = mongoose.connection

db.on('error', (err) => {
  console.error('连接失败', err)
})

db.on('open', () => {
  console.log('连接成功')
})

console.log('加载了')
